package Demo14;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;


public class Demo14 {
    public static void main(String[] args) throws InterruptedException {

         BlockingQueue<String> queue = new ArrayBlockingQueue<>(100);

        // 入队列
         queue.put("aaa");
         System.out.println("添加一个元素");
         queue.put("bbb");
         System.out.println("添加一个元素");


         //出队列
        String s = queue.take();
        System.out.println("获取到一个元素: " + s);

        s = queue.take();
        System.out.println("获取到一个元素: " + s);

        s = queue.take();
        System.out.println("获取到一个元素: " + s);

    }
}